#
# 这个类主要是用来显示进度信息以及进度条
# 方便Debug 和确认进度
#
module Aio::Ui
	module Verbose

		def progress_bar(total, num, info)
			percent = ((num.to_f / total.to_f) * 100).to_i
			buf = "#" * (percent / 2)
			#printf("#{' ' * 120}\r")
			printf("[%-50s] [%d%%], [%s]\r", buf, percent, info)
		end
			
		def print_good(str)
			res = "[+] " << str
      Aio::Ui::Logger.instance.info = res
      puts res
		end

		def print_error(str)
			res = "[-] " << str
      Aio::Ui::Logger.instance.info = res
      puts res
		end

		def clear_line
			printf("#{' ' * 100}\r")
		end
		
	end

end
